################################################################################
# Documentation
################################################################################

<%
  metadata_version = quote_string("1.1")
  supported_by = quote_string("community")
-%>
ANSIBLE_METADATA = {'metadata_version': <%= metadata_version -%>,
                    'status': ["preview"],
                    'supported_by': <%= supported_by -%>}

DOCUMENTATION = '''
---
<%= ansible_style_yaml({
  'module' => module_name(object),
  'description' => format_description(object.description),
  'short_description' => "Creates a GCP #{object.name}",
  'author' => "Google Inc. (@googlecloudplatform)",
  'requirements' => ["python >= 2.6", "requests >= 2.18.4", "google-auth >= 1.3.0"],
  'options' => [
    {
      'state' => {
        'description' => ['Whether the given object should exist in GCP'],
        'choices' => ['present', 'absent'],
        'default' => 'present',
        'type' => 'str'
      },
    },
    object.all_user_properties.reject(&:output).map { |p| documentation_for_property(p) },
    auth_docs,
  ].flatten.compact.reduce({}, :merge),
  'notes' => (
    [
      ("API Reference: U(#{object.references.api})" if object.references.api),
      (object.references.guides.map { |guide, link| "#{guide}: U(#{link})" } if object.references),
      auth_notes,
      (object.notes if object.notes)
    ].flatten.compact if object.references
  )
})-%>
'''

<% if example -%>
EXAMPLES = '''
<% res_readable_name = object.name.titleize -%>
<% if example.dependencies -%>
<%   example.dependencies.each do |depend| -%>
<%= lines(depend.build_test('present', object, false), 1) -%>
<%   end # example.dependencies.each -%>
<% end # if example.dependencies -%>
<%= lines(example.task.build_example('present', object)) -%>
'''
<% end -%>

RETURN = '''
<%= ansible_style_yaml(object.all_user_properties.map { |p| returns_for_property(p) }.reduce({}, :merge)) -%>
'''
